<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>订单发货</title>
<link href="<%=basePath%>skin/css/validform/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=basePath%>skin/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/validform/Validform_v5.3.2_min.js"></script>
<script language="javascript">
	 $().ready(function() {
		//验证
		var validform = $("#form1").Validform({
			btnSubmit:"#save",
			tiptype:3
		});
		validform.addRule([
			{
			    ele:"#trackingNo",
			    datatype:"n",
			    nullmsg:"请输入运单号！"
			}
		]);
	 });
</script>
</head>

<body>
<form id="form1" name="form1" method="post" action="<%=basePath%>admin/order/shipping.shtml">
	<input type="hidden" name="id" value="${order.id}" />
	订单信息
	<table width="98%" class="input tabContent">
		<tr bgcolor="#FAFAF1" height="22">
			<th width="10%" align="right">编号：</th>
			<td width="40%">${order.sn }</td>
			<th width="10%" align="right">创建日期：</th>
			<td width="40%"><fmt:formatDate value="${order.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
		</tr>
		<tr bgcolor="#FAFAF1" height="22">
			<th align="right">订单状态：</th>
			<td>${order.orderStatus }</td>
			<th align="right">支付状态：</th>
			<td>${order.paymentStatus }</td>
		</tr>
		<tr bgcolor="#FAFAF1" height="22">
			<th align="right">配送状态：</th>
			<td>${order.shippingStatus }</td>
			<th align="right">用户名：</th>
			<td>${order.sn }</td>
		</tr>
		<tr bgcolor="#FAFAF1" height="22">
			<th align="right">订单金额：</th>
			<td><fmt:formatNumber value="${order.amount}" pattern="0.00"/></td>
			<th align="right">已付金额：</th>
			<td><fmt:formatNumber value="${order.amountPaid }" pattern="0.00"/></td>
		</tr>
		<tr bgcolor="#FAFAF1" height="22">
			<th align="right">商品重量：</th>
			<td><fmt:formatNumber value="${order.weight }" pattern="0.00"/></td>
			<th align="right">商品数量：</th>
			<td><fmt:formatNumber value="${order.quantity }" pattern="0.00"/></td>
		</tr>
		<tr bgcolor="#FAFAF1" height="22">
			<th align="right">运费：</th>
			<td><fmt:formatNumber value="${order.freight }" pattern="0.00"/></td>
			<th align="right">支付手续费：</th>
			<td><fmt:formatNumber value="${order.fee }" pattern="0.00"/></td>
		</tr>
		<tr bgcolor="#FAFAF1" height="22">
			<th align="right">支付方式：</th>
			<td>${order.paymentMethodName }</td>
			<th align="right">配送方式：</th>
			<td>${order.shippingMethodName }</td>
		</tr>
		<tr bgcolor="#FAFAF1" height="22">
			<th align="right">发票抬头：</th>
			<td>
				${order.invoiceTitle }
				<input type="checkbox" id="isInvoice" name="isInvoice" value="true" <c:if test="${order.isInvoice }">checked</c:if> disabled/> 是否开据发票
			</td>
			<th align="right">税金：</th>
			<td>0</td>
		</tr>
		<tr bgcolor="#FAFAF1" height="22">
			<th align="right">收货人：</th>
			<td>${order.consignee }</td>
			<th align="right">地区：</th>
			<td>
				${order.areaName}
			 </td>
		</tr>
		<tr bgcolor="#FAFAF1" height="22">
			<th align="right">地址：</th>
			<td>${order.address }</td>
			<th align="right">邮编：</th>
			<td>
				${order.zipCode }
			 </td>
		</tr>
		<tr bgcolor="#FAFAF1" height="22">
			<th align="right">电话：</th>
			<td>${order.phone }</td>
			<th align="right">附言：</th>
			<td colspan=3>
				${order.memo }
			 </td>
		</tr> 
	</table>
	商品信息
	<table width="98%" class="input tabContent">
		<tr align="center" bgcolor="#E7E7E7" height="22">
			<td width="20%">
				编号
			</td>
			<td width="20%">
				名称
			</td>
			<td width="20%">
				价格
			</td>
			<td width="20%">
				数量
			</td>
			<td width="20%">
				小计
			</td>
		</tr>
		<c:forEach items="${order.orderItems}" var="orderItem">
			<tr align='center' bgcolor="#FFFFFF"
					onMouseMove="javascript:this.bgColor='#FCFDEE';"
					onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
		  		<td>${orderItem.sn}</td>
		  		<td>${orderItem.fullName} <c:if test="${orderItem.isGift }"><font color="red">[赠品]</font></c:if></td>
		  		<td>
		  			<c:choose>
		  				<c:when test="${orderItem.isGift }">-</c:when>
		  				<c:otherwise><fmt:formatNumber value="${orderItem.price}" pattern="0.00"/></c:otherwise>
		  			</c:choose>
		  		</td>
		  		<td>
		  			<c:choose>
		  				<c:when test="${orderItem.isGift }">-</c:when>
		  				<c:otherwise><fmt:formatNumber value="${orderItem.quantity}" pattern="0.00"/></c:otherwise>
		  			</c:choose>
		  		</td>
		  		<td>
					<c:choose>
		  				<c:when test="${orderItem.isGift }">-</c:when>
		  				<c:otherwise><fmt:formatNumber value="${orderItem.subtotal}" pattern="0.00"/></c:otherwise>
		  			</c:choose>
				</td>
	  	</c:forEach>
  	</table>
  	<table width="98%">
		<tr bgcolor="#EEF4EA">
			<th align="right">物流公司：</th>	
			<td>
				<select name="deliveryCorpId">
					<c:forEach items="${deliveryCorps}" var="deliveryCorp">
						<option value="${deliveryCorp.id }">${deliveryCorp.name }</option>
					</c:forEach>
				</select>
			</td>
			<th align="right">运单号：</th>
			<td><input id="trackingNo" name="trackingNo" size="15" class="input"/></td>
			<td height="36" >
				<input type="button" value="确定" class="button" id="save"/>
				<input type="button" value="返回" class="button" onclick="location.href='<%=basePath%>admin/order/list.shtml'" >
			</td>
		</tr>
	</table>
</form>
</body>
</html>
